﻿Imports System.Data.SqlClient
Public Class PhieuGioiThieuDAO
    Public Function Insert(ByVal phieu As PhieuGioiThieuDTO) As Boolean
        Try
            Dim data As New DataProvider
            Dim cnn As New SqlConnection
            cnn = data.ConnectionData()
            Dim cmd As SqlCommand = New SqlCommand()
            cmd.Connection = cnn
            cmd.CommandText = "exec usp_InsertPHIEUGIOITHIEU @MaDangTin,@MaSinhVien,@GiaTien,@NgayLapPhieu,@MaPhieu"
            Dim para As SqlParameter = cmd.Parameters.Add("@MaPhieu", SqlDbType.Int)
            para.Value = phieu.MaPhieu
            para = cmd.Parameters.Add("@MaDangTin", SqlDbType.Int)
            para.Value = phieu.MaDangTin
            para = cmd.Parameters.Add("@MaSinhVien", SqlDbType.Int)
            para.Value = phieu.MaSinhVien
            para = cmd.Parameters.Add("@GiaTien", SqlDbType.Int)
            para.Value = phieu.GiaTien
            para = cmd.Parameters.Add("@NgayLapPhieu", SqlDbType.VarChar)
            para.Value = phieu.NgayLap
            cmd.ExecuteNonQuery()
            Return True
        Catch ex As Exception
            MessageBox.Show(ex.Message)
            Return False
        End Try
        Return False
    End Function
End Class
